#define _CRT_SECURE_NO_WARNINGS 1
#include <iostream>
#include <vector>
using namespace std;


int main() {
	int n = 0, m = 0;
	cin >> n >> m;
	vector<int> nums(m + 1);
	int index = 1;
	for (int i = 1; i <= m; i++) {
		nums[index++] = i;
	}

	vector<int> temp;
	temp.push_back(0);

	for (int i = 1; i < nums.size(); i++) {
		int luck = nums[i];
		if (luck > 1) {
			for (int j = 1; j < i; j++) {
				temp.push_back(nums[j]);
			}
			for (int j = i; j < nums.size(); j++) {
				if (j % luck != 0) {
					temp.push_back(nums[j]);
				}
				else {
					if (nums[j] == luck) {
						i--;
					}
				}
			}
			nums = temp;
			temp.clear();
			temp.push_back(0);
		}
	}
	int ret = 0;
	for (int i = 1; i < nums.size(); i++) {
		cout << nums[i] << " ";
	}
	cout << endl;
	int begin = 0;
	for (int i = 1; i < nums.size(); i++) {
		if (nums[i] >= n) {
			begin = i;
			break;
		}
	}
	while (begin < nums.size() && nums[begin] <= m) {
		if (nums[begin] != n && nums[begin] != m) {
			ret++;
		}
		begin++;
	}
	cout << ret << endl;
	return 0;
}